﻿namespace ColorWheel.Silverlight.Spectrum.Demo
{
    using System.ComponentModel;
    using System.Windows.Controls;
    using ColorWheel.Core;
    using System.Windows.Media;

    public partial class MainPage : UserControl, INotifyPropertyChanged
    {
        Palette                                         m_palette;
        public event PropertyChangedEventHandler        PropertyChanged;

        public MainPage()
        {
            InitializeComponent();
        
            DataContext = this;
            Palette     = Palette.Create(new RGBColorWheel(), Colors.Magenta, PaletteSchemaType.Complementary, 10);
        }

        private void FirePropertyChanged(
            string                                      name
        )
        {
            if(PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }

        public Palette Palette
        {
            get
            {
                return m_palette;
            }
            set
            {
                m_palette = value;
                FirePropertyChanged("Palette");
            }
        }
    }
}
